//
//  ViewController.m
//  addressBookTest
//
//  Created by sheepyellow on 15/8/22.
//  Copyright (c) 2015年 sheepyellow. All rights reserved.
//

#import "ViewController.h"
#import "CBDAddressBookManager.h"
@interface ViewController ()
@property(strong, nonatomic)MUCAddressBookManager* addressBookManager;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.addressBookManager addUpdateSuccessObserver:self selector:@selector(updateAddressBook:)];
    
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (IBAction)tapRead:(id)sender {
    BOOL b=[self.addressBookManager accessAddressBook];
    NSLog(@"%lu",(unsigned long)self.addressBookManager.records.count);
}

-(MUCAddressBookManager*)addressBookManager
{
    if(!_addressBookManager)
    {
        _addressBookManager=[MUCAddressBookManager shareInstance];
    }
    return _addressBookManager;
}

-(void)updateAddressBook:(NSDictionary*)dict
{
    NSLog(@"%@",dict);
}

@end
